package com.bruce.demo1.principles.demo2.lsp.demo1;

/**
 * @PROJECT_NAME design_patterns
 * @DESCRIPTION 提供resize方法
 * @AUTHOR CNBruceLee
 * @DATE 2021/6/20 13:18
 */
public class RectangleResize {

    //如果长小于宽度，则自动加长宽度
    public static void resize(Rectangle rectangle) {
        while (rectangle.getLength() <= rectangle.getWidth()) {
            rectangle.setLength(rectangle.getWidth() + 1);
        }
    }

    public static void printLengthAndWidth(Rectangle rectangle) {
        System.out.println("length:" + rectangle.getLength());
        System.out.println("width:" + rectangle.getWidth());
    }

}
